package com.vids.enums;

/**
 * 1400数据类型与kafka数据key的关系
 */
public enum DataCategoryEnum {

    PERSON("11", "person"),
    PROFILE("18", "profile"),
    PROFILESUBJECT("19", "profileSubject"),
    DATACLASSTAB("17", "dataClassTab"),
    FACE("12", "face"),
    MOTORVEHICLE("13", "motorVehicle"),
    NONMOTORVEHICLE("14", "nonMotorVehicle"),
    THING("15", "things"),
    //此处17和视图库标准分类标签17冲突，这里进行修改为90
    IMSI("90", "imsi");

    private String viidDataType;
    private String kafkaDataKey;

    private DataCategoryEnum(String viidDataType, String kafkaDataKey) {
        this.viidDataType = viidDataType;
        this.kafkaDataKey = kafkaDataKey;
    }

    public static String getKafkaDataKeyByViidDataType(String viidDataType){
        String kafkaDataKey = "";
        if(viidDataType != null) {
            for (DataCategoryEnum e : DataCategoryEnum.values()) {
                if(e.viidDataType.equals(viidDataType)) {
                    kafkaDataKey = e.kafkaDataKey;
                    break;
                }
            }
        }
        return kafkaDataKey;
    }

    public static String getViidDataTypeByKafkaDataKey(String kafkaDataKey){
        String viidDataType = null;
        if(kafkaDataKey != null) {
            for (DataCategoryEnum e : DataCategoryEnum.values()) {
                if(e.kafkaDataKey.equals(kafkaDataKey)) {
                    viidDataType = e.viidDataType;
                    break;
                }
            }
        }
        return viidDataType;
    }

    public String getKafkaDataKey() {
        return kafkaDataKey;
    }

    public String getViidDataType() {
        return viidDataType;
    }

}
